|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
00001 /****************************************************************************** 00002 * 00003 * Freescale Semiconductor Inc. 00004 * (c) Copyright 2004-2010 Freescale Semiconductor 00005 * ALL RIGHTS RESERVED. 00006 * 00007 ****************************************************************************/ 00019 #ifndef __FREEMASTER_PROTOCOL_H 00020 #define __FREEMASTER_PROTOCOL_H 00021 00022 /*------------------------------------- 00023 command message - standard commands 00024 -------------------------------------*/ 00025 00026 #define FMSTR_CMD_READMEM 0x01U 00027 #define FMSTR_CMD_WRITEMEM 0x02U 00028 #define FMSTR_CMD_WRITEMEMMASK 0x03U 00029 #define FMSTR_CMD_READMEM_EX 0x04U /* read a block of memory */ 00030 #define FMSTR_CMD_WRITEMEM_EX 0x05U /* write a block of memory */ 00031 #define FMSTR_CMD_WRITEMEMMASK_EX 0x06U /* write block of memory with bit mask */ 00032 #define FMSTR_CMD_SETUPSCOPE 0x08U 00033 #define FMSTR_CMD_SETUPREC 0x09U 00034 #define FMSTR_CMD_SETUPSCOPE_EX 0x0aU /* setup the oscilloscope */ 00035 #define FMSTR_CMD_SETUPREC_EX 0x0bU /* setup the recorder */ 00036 #define FMSTR_CMD_SENDAPPCMD 0x10U /* send the application command */ 00037 #define FMSTR_CMD_GETTSAINFO 0x11U /* get TSA info */ 00038 #define FMSTR_CMD_GETTSAINFO_EX 0x12U /* get TSA info 32bit */ 00039 #define FMSTR_CMD_SFIOFRAME_1 0x13U /* deliver & execute SFIO frame (even) */ 00040 #define FMSTR_CMD_SFIOFRAME_0 0x14U /* deliver & execute SFIO frame (odd) */ 00041 #define FMSTR_CMD_PIPE 0x15U /* read/write pipe data */ 00042 00043 /*------------------------------------- 00044 command message - Fast Commands 00045 -------------------------------------*/ 00046 00047 /* no data part */ 00048 #define FMSTR_CMD_GETINFO 0xc0U /* retrieve board information structure */ 00049 #define FMSTR_CMD_STARTREC 0xc1U /* start data recorder */ 00050 #define FMSTR_CMD_STOPREC 0xc2U /* stop data recorder */ 00051 #define FMSTR_CMD_GETRECSTS 0xc3U /* get the recorder status */ 00052 #define FMSTR_CMD_GETRECBUFF 0xc4U 00053 #define FMSTR_CMD_READSCOPE 0xc5U /* read the scope data */ 00054 #define FMSTR_CMD_GETAPPCMDSTS 0xc6U /* get the application command status */ 00055 #define FMSTR_CMD_GETINFOBRIEF 0xc8U /* retrieve a subset of board information structure */ 00056 #define FMSTR_CMD_GETRECBUFF_EX 0xc9U /* get the recorder data */ 00057 #define FMSTR_CMD_SFIOGETRESP_0 0xcaU /* retry to get last SFIO response (even) */ 00058 #define FMSTR_CMD_SFIOGETRESP_1 0xcbU /* retry to get last SFIO response (odd) */ 00059 00060 /* 2 bytes data part */ 00061 #define FMSTR_CMD_READVAR8 0xD0U 00062 #define FMSTR_CMD_READVAR16 0xD1U 00063 #define FMSTR_CMD_READVAR32 0xD2U 00064 #define FMSTR_CMD_GETAPPCMDDATA 0xD3U /* get the application command data */ 00065 #define FMSTR_CMD_GETSTRLEN 0xD4U /* get string length (required by TSA) */ 00066 00067 /* 4 bytes data part */ 00068 #define FMSTR_CMD_READVAR8_EX 0xe0U /* read byte variable */ 00069 #define FMSTR_CMD_READVAR16_EX 0xe1U /* read word variable */ 00070 #define FMSTR_CMD_READVAR32_EX 0xe2U /* read dword variable */ 00071 #define FMSTR_CMD_WRITEVAR8 0xe3U /* write byte variable */ 00072 #define FMSTR_CMD_WRITEVAR16 0xe4U /* write word variable */ 00073 #define FMSTR_CMD_WRITEVAR8MASK 0xe5U /* write specified bits in byte variable */ 00074 #define FMSTR_CMD_GETSTRLEN_EX 0xe6U /* get string length (required by TSA) */ 00075 00076 /* 6 bytes data part */ 00077 #define FMSTR_CMD_WRITEVAR32 0xf0U /* write dword variable */ 00078 #define FMSTR_CMD_WRITEVAR16MASK 0xf1U /* write specified bits in word variable */ 00079 00080 /*------------------------------------- 00081 response message - status byte 00082 -------------------------------------*/ 00083 00084 /* flags in response codes */ 00085 #define FMSTR_STSF_ERROR 0x80U /* FLAG: error answer (no response data) */ 00086 #define FMSTR_STSF_VARLEN 0x40U /* FLAG: variable-length answer (length byte) */ 00087 #define FMSTR_STSF_EVENT 0x20U /* FLAG: reserved */ 00088 00089 /* confirmation codes */ 00090 #define FMSTR_STS_OK 0x00U /* operation finished successfully */ 00091 #define FMSTR_STS_RECRUN 0x01U /* data recorder is running */ 00092 #define FMSTR_STS_RECDONE 0x02U /* data recorder is stopped */ 00093 00094 /* error codes */ 00095 #define FMSTR_STC_INVCMD 0x81U /* unknown command code */ 00096 #define FMSTR_STC_CMDCSERR 0x82U /* command checksum error */ 00097 #define FMSTR_STC_CMDTOOLONG 0x83U /* command is too long */ 00098 #define FMSTR_STC_RSPBUFFOVF 0x84U /* the response would not fit into transmit buffer */ 00099 #define FMSTR_STC_INVBUFF 0x85U /* invalid buffer length or operation */ 00100 #define FMSTR_STC_INVSIZE 0x86U /* invalid size specified */ 00101 #define FMSTR_STC_SERVBUSY 0x87U /* service is busy */ 00102 #define FMSTR_STC_NOTINIT 0x88U /* service is not initialized */ 00103 #define FMSTR_STC_EACCESS 0x89U /* access is denied */ 00104 #define FMSTR_STC_SFIOERR 0x8AU /* Error in SFIO frame */ 00105 #define FMSTR_STC_SFIOUNMATCH 0x8BU /* Even/odd mismatch in SFIO transaction */ 00106 #define FMSTR_STC_PIPEERR 0x8CU /* Pipe error */ 00107 #define FMSTR_STC_FASTRECERR 0x8DU /* Feature not implemented in Fast Recorder */ 00108 #define FMSTR_STC_CANTGLERR 0x8EU /* CAN fragmentation (toggle bit) error */ 00109 #define FMSTR_STC_CANMSGERR 0x8FU /* CAN message format error */ 00110 #define FMSTR_STC_FLOATDISABLED 0x90U /* Floating point triggering is not enabled */ 00111 00112 /****************************************************************************** 00113 * Protocol constants 00114 *******************************************************************************/ 00115 00116 #define FMSTR_SOB 0x2bU /* '+' - start of message*/ 00117 #define FMSTR_FASTCMD 0xc0U /* code of fast cmd 0xc0> */ 00118 #define FMSTR_FASTCMD_DATALEN_MASK 0x30U /* mask of data length part of fast command */ 00119 #define FMSTR_FASTCMD_DATALEN_SHIFT 3 00120 #define FMSTR_DESCR_SIZE 25U /* length board desription string */ 00121 00122 /* Board configuration flags */ 00123 #define FMSTR_CFGFLAG_BIGENDIAN 0x01U /*/< used when CPU is big endian */ 00124 00125 /* TSA-global flags */ 00126 #define FMSTR_TSA_INFO_VERSION_MASK 0x000fU /*/< TSA version */ 00127 #define FMSTR_TSA_INFO_32BIT 0x0100U /*/< TSA address format (16/32 bit) */ 00128 #define FMSTR_TSA_INFO_HV2BA 0x0200U /*/< TSA HawkV2 byte-addressing mode */ 00129 00130 /****************************************************************************** 00131 * CAN Protocol constants 00132 *******************************************************************************/ 00133 00134 /* control byte (the first byte in each CAN message) */ 00135 #define FMSTR_CANCTL_TGL 0x80 /* toggle bit, first message clear, then toggles */ 00136 #define FMSTR_CANCTL_M2S 0x40 /* master to slave direction */ 00137 #define FMSTR_CANCTL_FST 0x20 /* first CAN message of FreeMASTER packet */ 00138 #define FMSTR_CANCTL_LST 0x10 /* last CAN message of FreeMASTER packet */ 00139 #define FMSTR_CANCTL_SPC 0x08 /* special command (in data[1], handled by CAN sublayer (no FM protocol decode) */ 00140 #define FMSTR_CANCTL_LEN_MASK 0x07 /* number of data bytes after the CTL byte (0..7) */ 00141 00142 /* special commands */ 00143 #define FMSTR_CANSPC_PING 0xc0 00144 00145 /****************************************************************************** 00146 * Packet Driven BDM Protocol constants 00147 *******************************************************************************/ 00148 00149 /* Communication buffer borders */ 00150 #define FMSTR_PDBDM_BUFFBORDER_CODE1 0x07e0 /* Beginning Magic Number for Packet driven BDM communication buffer */ 00151 #define FMSTR_PDBDM_BUFFBORDER_CODE2 0xf81f /* Ending Magic Number for Packet driven BDM communication buffer */ 00152 00153 /* Packet Driven BDM Communication States */ 00154 #define FMSTR_PDBDM_NOT_INIT 0x00 /* FreeMASTER driver is not initalized */ 00155 #define FMSTR_PDBDM_IDLE 0x01 /* FreeMASTER serial driver is configured to BDM and ready to communicate */ 00156 #define FMSTR_PDBDM_RECEIVED_FRAME 0x02 /* FreeMASTER Communication buffer includes frame to be proceeded */ 00157 #define FMSTR_PDBDM_DECODING_FRAME 0x04 /* Received frame is proceeding */ 00158 #define FMSTR_PDBDM_FRAME_TO_SEND 0x08 /* FreeMASTER Communication buffer includes frame to be send back */ 00159 00160 #endif /* __FREEMASTER_PROTOCOL_H */ 00161 00162